* Carry out R-squared analysis discussed in Section 5.2.2

clear all

use "$savedata/masterdata.dta", replace

keep if sample25==1
gen vol = vol25

* Create interactions between doctors and hospital-years)
egen hyd_id = group(doctor_id hyid)

* test R-squared
reghdfe survive365 c.prevyear_cost, absorb(i.sex##i.derv_age i.black i.mixed i.chinese i.asian i.race_miss i.ynch* i.prevyear_stroke i.di1 i.di2 i.di3 i.di4 i.di5 i.shock i.arythmia i.arthero i.arrest i.dow##i.admidate_mont##i.finyear i.hyid i.doctor_id, savefe) keepsingleton

di e(r2)

reghdfe survive365 c.prevyear_cost, absorb(i.sex##i.derv_age i.black i.mixed i.chinese i.asian i.race_miss i.ynch* i.prevyear_stroke i.di1 i.di2 i.di3 i.di4 i.di5 i.shock i.arythmia i.arthero i.arrest i.dow##i.admidate_mont##i.finyear i.hyd_id, savefe) keepsingleton

di e(r2)
